package vip.xiaonuo.smzq.modular.lifecycle.vo.datamanager;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import vip.xiaonuo.smzq.modular.lifecycle.entity.LifeCycleMineStore;

import java.time.LocalDate;

/**
 * 查询生命周期节点数据
 */
@Data
public class LifeCyclePedigeeNodeVO {
    @ApiModelProperty("节点名称")
    private String nodeName;

    @ApiModelProperty("族谱节点名称")
    private String pedNodeName;

    @ApiModelProperty("节点日期")
    private LocalDate nodeDate;

    @ApiModelProperty("族谱id")
    private String pedId;

    @ApiModelProperty("族谱父id")
    private String pedPid;

    @ApiModelProperty("登记分类编号")
    private String regClassCode;

    @ApiModelProperty("新立索引")
    private String xlIndex;

    @ApiModelProperty("许可证号")
    private String xkzh;

    @ApiModelProperty("矿业权类型")
    private Integer exporeType;


    @ApiModelProperty("前端显示的label")
    private String label;
    @ApiModelProperty("前端值")
    private String value;



    @ApiModelProperty("叶子节点")
    private boolean leaf = true ;
    public void init(){
//        将整个实体类的json字符串变成value
//        this.setValue(this.getPedId()+"@@"+this.getXkzh());
//        this.setValue(JSONUtil.toJsonStr(this));
        this.setNodeName(StrUtil.isNotBlank(this.getPedNodeName())?this.getPedNodeName():this.getNodeName());
        this.setValue(this.getPedId());
        this.setLabel(this.getRegClassCode()+","+this.nodeName+","+ DateUtil.format(Convert.toDate(this.nodeDate), DatePattern.NORM_DATE_PATTERN)+ (ObjUtil.isNotEmpty(this.xlIndex)?",新立"+this.xlIndex:""));
    }
}
